const inputDom = document.querySelector('input');
function throttle(callback, timeout = 2000) {
    let timeId;
    return function () {
        if (!timeId) {
            callback(...arguments);
            timeId = setTimeout(() => {
                timeId = null;
            }, timeout);
        }
    }
}

inputDom.oninput = throttle(function (e) {
    const divDom = document.querySelector('div');
    divDom.innerText = e.target.value;
})